<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>resin安装与配置 | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>resin安装与配置</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/Resin/">Resin</a>
			</span>
		
	</div>

	

	
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;resin 同样也需要 jdk 的支持，所以第一步也是安装 jdk 。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="http://caucho.com/" target="_blank" rel="external">resin官方网站</a> ，它分两个版本，resin 是开源的，另外一个 resinpro 为商业版本。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@192 src]<span class="comment"># wget http://caucho.com/download/resin-4.0.51.tar.gz</span></div><div class="line">[root@192 src]<span class="comment"># tar zxvf resin-4.0.51.tar.gz </span></div><div class="line">[root@192 src]<span class="comment"># cd resin-4.0.51</span></div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">./configure --prefix=/usr/<span class="built_in">local</span>/resin --with-java-home=/usr/<span class="built_in">local</span>/jdk1.8.0_111</div><div class="line">make &amp;&amp; make install</div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 resin-4.0.51]<span class="comment"># /etc/init.d/resin start</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下面简单配置：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 resin-4.0.51]<span class="comment"># cd /usr/local/resin/conf/</span></div><div class="line">[root@192 conf]<span class="comment"># vim resin.xml</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;resin 的配置文件和 tomcat 的很像，基本结构为：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">&lt;cluster id=<span class="string">"app"</span>&gt;</div><div class="line">&lt;host&gt;&lt;/host&gt;</div><div class="line">&lt;/cluster&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;其中虚拟主机配置就在 <host></host> 里配置</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># vim resin.xml</span></div><div class="line"></div><div class="line">&lt;host id=<span class="string">"www.123.com"</span> root-directory=<span class="string">"."</span>&gt;</div><div class="line">  &lt;web-app id=<span class="string">"/"</span> root-directory=<span class="string">"/tmp/resin"</span>&gt;</div><div class="line">&lt;/host&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;注意，这里要放在  <cluster id="app"> 下边</cluster></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建文件夹，并重启 resin</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># mkdir /tmp/resin</span></div><div class="line">[root@192 conf]<span class="comment"># service resin stop</span></div><div class="line">Stopping resin: .</div><div class="line">[root@192 conf]<span class="comment"># service resin start</span></div><div class="line">Starting resin: .</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然后编辑一个测试文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># vim /tmp/resin/222.jsp</span></div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&lt;html&gt;&lt;body&gt;&lt;center&gt; </div><div class="line"> </div><div class="line">Now time is: &lt;%=new java.util.Date()%&gt; </div><div class="line"> </div><div class="line">&lt;/center&gt;&lt;/body&gt;&lt;/html&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;测试</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># curl -x127.0.0.1:80 www.123.com/222.jsp</span></div><div class="line">&lt;html&gt;&lt;body&gt;&lt;center&gt; </div><div class="line"> </div><div class="line">Now time is: Wed Apr 05 13:30:44 CST 2017 </div><div class="line"> </div><div class="line">&lt;/center&gt;&lt;/body&gt;&lt;/html&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;更改监听端口，需编辑配置文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># vim resin.properties</span></div></pre></td></tr></table></figure>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/resin%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE/01.png?raw=true" alt=""></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;修改为</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/resin%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE/02.png?raw=true" alt=""></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重启服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@192 conf]<span class="comment"># service resin stop</span></div><div class="line">Stopping resin: .</div><div class="line">[root@192 conf]<span class="comment"># service resin start</span></div><div class="line">Starting resin: .</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;登录本地 IP 就能访问 resin 的默认页面</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/resin%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE/03.png?raw=true" alt=""></figure></p>

	

	
		<span class="different-posts"><a href="/2017/10/12/Resin/1. resin安装与配置/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
